﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GamePlugin.Logics.Core;
using WindowsInput;

namespace GamePlugin.Logics.Game.Actions
{
    public class DActionIdle : MachineState
    {
        public override void Initialize()
        {
            this.AddState("CheckKeys");
            this["CheckKeys"].UpdateEvent += new EventHandler<GameTimeEventArgs>((o, e) => this.CheckKeys(o, e));

            this.DefaultState = "CheckKeys";
        }

        public void CheckKeys(object o, GameTimeEventArgs e)
        {
            Workspace.Instance.LastSearchItem = null;
            DActionRunItemSearchStart.FromIdleState = true;

            InputSimulator input = Helper.DiabloPluginGame.InputSimulator;
            if (input.InputDeviceState.IsHardwareKeyDown(WindowsInput.Native.VirtualKeyCode.F3))
            {
                Helper.Log("Start Find Items");
                this.Owner.ChangeToState(typeof(DActionRun).Name);
            }
        }
    }
}
